﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Castle.Windsor;
using Castle.MicroKernel.Registration;
using NGinnBPM.MessageBus;
using NGinnBPM.MessageBus.Windsor;
using NGinnBPM.Lib;
using NGinnBPM.Services;
using NGinnBPM.Runtime;
using NLog;
using NGinnBPM.Lib.Util;

namespace NGinnBPM.HostConfig.Install
{
    /// <summary>
    /// Installer class for auto-configuring NGinn BPM services
    /// in a castle windsor container
    /// </summary>
    public class NGinnWindsorInstaller 
    {
        private Logger log = LogManager.GetCurrentClassLogger();

        public void Install(IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store)
        {
            string baseDir = AppDomain.CurrentDomain.BaseDirectory;
            log.Info("Configuring NGinn. Base directory is {0}", baseDir);
            NGinnHostConfigurator.BeginConfig(container)
                .SetBaseDirectory(baseDir)
                .FinishConfiguration();
        }
    }
}
